package router

import (
	"qianggougo/controller/common"
	"qianggougo/controller/private"
	"qianggougo/controller/public"

	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine {
	route := gin.Default()
	publicGroup := route.Group("/public")
	{
		publicGroup.GET("/index", public.GetIndexInfo) // 首页
		publicGroup.POST("/login", public.WxLogin)     // 微信登录
		publicGroup.GET("/ws", public.WsHandler)       // WebSocket 接口
		publicGroup.POST("/bullet", public.PushBullet) // 推送弹幕
	}

	privateGroup := route.Group("/private", common.Auth)
	{
		privateGroup.POST("/accredit", private.WxAccredit)    // 微信授权获取个人信息
		privateGroup.POST("/choose", private.SelectTheLineup) // 选择阵容
		privateGroup.GET("/score", private.GetScore)          // 获取得分
	}

	return route
}
